package com.manor.common.dialog

import android.content.Context
import com.lxj.xpopup.XPopup
import com.lxj.xpopup.core.CenterPopupView
import com.lxj.xpopup.interfaces.SimpleCallback
import com.manor.common.R
import kotlinx.android.synthetic.main.dialog_x_toast.view.*

/**
 *


 * @date  2020/7/24  11:14
 * @version 1.0
 */
class XToast (context: Context,private val str: String, private val delay: Long) :CenterPopupView(context){

    companion object{
        fun load(context: Context, str: String,callBack: SimpleCallback = SimpleCallback(), delay: Long = 1500){
            XPopup.Builder(context)
                    .setPopupCallback(callBack)
                    .asCustom(XToast(context, str, delay))
                    .show()
        }
    }

    override fun getImplLayoutId(): Int = R.layout.dialog_x_toast

    override fun onCreate() {
        super.onCreate()
        tvContent.text = str
        delayDismiss(delay)
    }



}